print dialog: Prevent cascading paper dialogs
authorMatthias Clasen <mclasen@redhat.com>
Sat, 29 Aug 2020 20:00:01 +0000 (16:00 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 29 Aug 2020 20:30:26 +0000 (16:30 -0400)
We trigger the paper dialog when the "manage" item
in the dropdown is selected. But the selection also
changes due to internal changes, such as reloading
the custom paper list when the paper dialog is
closed. We need to be extra careful to avoid triggering
another paper dialog when that happens.

gtk/gtkprintunixdialog.c

index 5375926db40d0ee2c396c8d6f692ad16692b2e9e..b7e486fb301e3b08682f107df5937d1c741834b0 100644 (file)
@@ -1614,7 +1614,7 @@ set_paper_size (GtkPrintUnixDialog *dialog,
   if (page_setup == NULL)
     return FALSE;
 
-  model = G_LIST_MODEL (dialog->page_setup_list);
+  model = gtk_drop_down_get_model (GTK_DROP_DOWN (dialog->paper_size_combo));
   for (i = 0; i < g_list_model_get_n_items (model); i++)
     {
       list_page_setup = g_list_model_get_item (model, i);
@@ -2901,9 +2901,8 @@ custom_paper_dialog_response_cb (GtkDialog *custom_paper_dialog,
 {
   GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (user_data);
 
-  gtk_print_load_custom_papers (dialog->custom_paper_list);
-
   dialog->internal_page_setup_change = TRUE;
+  gtk_print_load_custom_papers (dialog->custom_paper_list);
   update_paper_sizes (dialog);
   dialog->internal_page_setup_change = FALSE;